Skip to content

Final checks / modifications before submitting to CRAN#74

Merged
gvegayon merged 2 commits intomasterfrom
gvegayon/cran-1.25.0
Apr 7, 2026
Merged

Final checks / modifications before submitting to CRAN#74
gvegayon merged 2 commits intomasterfrom
gvegayon/cran-1.25.0

Conversation

@gvegayon
Copy link
Copy Markdown
Member

This pull request introduces several improvements and cleanups to the build system, development environment, and documentation for the netdiffuseR package. The most significant changes include the removal of the custom configure framework in favor of standard R mechanisms for OpenMP, updates to GitHub Actions workflows and development container setup, and minor documentation and code maintenance.

Build system and configuration cleanup:

  • Removed the custom configure framework and associated scripts, relying instead on R's built-in support for OpenMP and simplifying the build process. This includes deleting configure.ac, cleanup, and template Makevars files, and updating src/Makevars and src/Makevars.win to use standard R variables for OpenMP flags. [1] [2] [3] [4] [5]
  • Updated .Rbuildignore to stop ignoring src/Makevars, ensuring the correct file is included in the build.

Continuous integration and development environment:

  • Updated GitHub Actions workflow files to use the latest versions of actions, including actions/checkout@v6, actions/upload-artifact@v7, and actions/deploy-pages@v5, improving CI reliability and security. [1] [2] [3] [4] [5]
  • Modernized the development container by switching to a more minimal R base image, adding Quarto CLI installation, and installing an additional VS Code extension for ChatGPT support. [1] [2]

Documentation and versioning:

  • Updated documentation to reflect the new package version (1.25.0), including README.md and NEWS.md, and listed new user-visible and internal changes. [1] [2] [3] [4] [5]
  • Minor Makefile improvements: removed redundant --vanilla flag from Rscript calls for consistency. [1] [2] [3]

Code maintenance:

  • Improved type safety in src/plot.cpp by adding explicit type casts in size checks.

These changes collectively modernize the package infrastructure, improve maintainability, and ensure compatibility with current R and CI tooling.

Copilot AI review requested due to automatic review settings March 27, 2026 17:44
@gvegayon gvegayon linked an issue Mar 27, 2026 that may be closed by this pull request
@gvegayon gvegayon requested review from aoliveram and removed request for Copilot March 27, 2026 17:45
@gvegayon
Copy link
Copy Markdown
Member Author

gvegayon commented Apr 6, 2026

@aoliveram, I realized there is a missing figure in one of your vignettes. The pkgdown workflow is failing with the following message:

! Failed to render
  'vignettes/simulating-multiple-behaviors-on-networks.Rmd'.
✖ Quitting from simulating-multiple-behaviors-on-networks.Rmd:37-39
  [unnamed-chunk-1]
Caused by error:
! Cannot find the file(s): "/home/runner/anibal/netdiffuseR-original/playground/images/diagrams-single-1.png"
Backtrace:
    ▆
 1. └─knitr::include_graphics("~/anibal/netdiffuseR-original/playground/images/diagrams-single-1.png")
 2.

Can you share the images that you were planning to add to the vignette? Feel free to attach them here as a comment to the PR and I can do the rest. Thanks!

@aoliveram
Copy link
Copy Markdown
Member

aoliveram commented Apr 7, 2026

Here are the missing files, @gvegayon . I remember that when I wrote that vignette, I wanted to build some more professional schemes. What do you think?

diagrams-single-1.png

diagrams-single-1

diagrams-multiple-1.png

diagrams-multiple-1

table_1.png

table_1

@gvegayon
Copy link
Copy Markdown
Member Author

gvegayon commented Apr 7, 2026

Here are the missing files, @gvegayon . I remember that when I wrote that vignette, I wanted to build some more professional schemes. What do you think?

diagrams-single-1.png

diagrams-single-1 `diagrams-multiple-1.png` diagrams-multiple-1 `table_1.png` table_1

Let me see what I can do.

@gvegayon
Copy link
Copy Markdown
Member Author

gvegayon commented Apr 7, 2026

I think we can do it in Markdown and it will look almost the same:

rdiffnet( graph, seed.p.nodes, seed.nodes, behavior, threshold.dist)

Step 0.0: setting n and t if not provided

  • this depends on graph

Step 1.0: setting seed nodes

  • this depends on seed.p.nodes and seed.nodes

Step 2.0: setting threshold for each node

  • rdiffnet_make_threshold( threshold.dist, n )

Step 3.0: running the simulation

  • exposure( graph, exposure.args = list(...) )
    • ↳ allow us to compute time of adoption (toa)

Step 4.0: creating diffnet object

  • new_diffnet( graph, ..., toa, ... )

@gvegayon
Copy link
Copy Markdown
Member Author

gvegayon commented Apr 7, 2026

Here is another one:

rdiffnet( graph, seed.p.nodes, seed.nodes, behavior, threshold.dist)

Step 0.0: setting n and t if not provided

  • this depends on graph

Step 1.0: validate the arguments

  • rdiffnet_validate_args(seed.p.adopt, seed.nodes, behavior)
    • this allows us to set seed nodes

Step 2.0: setting threshold for each node

  • rdiffnet_make_threshold( threshold.dist, n, num_of_behaviors)

Step 3.0: running the simulation

  • exposure( graph, exposure.args = list(...) )
  • disadopt( expo, cumadopt, t)
    • to compute time of adoption (toa) for each behavior

Step 4.0: creating diffnet object

  • new_diffnet( graph, ..., toa, ... )

Step 5.0: splitting behaviors (optional)

  • split_behaviors( rdiffnet_multiple_obj )

@gvegayon
Copy link
Copy Markdown
Member Author

gvegayon commented Apr 7, 2026

Last one:

Parameter Type single multiple
seed.p.adopt numeric 0.1
c(0.1)
X
character X X
list X list(0.1, 0.05)
seed.nodes numeric c(2,4,6) c(2,4,6)
character "random"
c("random")
"random"
c("random")
c("random", "central")
list X list("random", "central")
list( c(1,3,5), c(2,4,6) )
behavior numeric X X
character "tobacco"
c("tobacco")
"tobacco"
c("tobacco")
c("tobacco", "alcohol")
list X list("tobacco", "alcohol")
threshold numeric 0.33
rep(0.33, 100)
0.33
rep(0.33, 100)
function function() runif(1) function() runif(1)
matrix X matrix( runif(100),
n_nodes, n_behavior)
list X list( 0.33, 0.66)
list( runif(100), runif(100))
list( function() runif(1),
function() runif(1))

@aoliveram
Copy link
Copy Markdown
Member

Looks great. Let's use those instead ;)

Copilot AI review requested due to automatic review settings April 7, 2026 16:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares netdiffuseR for CRAN submission by simplifying the native build configuration (removing the autoconf configure framework in favor of standard R OpenMP variables), modernizing CI/dev tooling, and updating package-facing documentation/artifacts for the 1.25.0 release.

Changes:

  • Removed the custom autoconf-based configure framework and introduced standard src/Makevars / updated src/Makevars.win OpenMP settings.
  • Updated release/docs materials (NEWS/README/vignette/man pages) and refreshed a README figure artifact.
  • Modernized infrastructure (GitHub Actions versions, devcontainer base image + Quarto install, Makefile tweaks).

Reviewed changes

Copilot reviewed 15 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
vignettes/simulating-multiple-behaviors-on-networks.Rmd Replaced embedded local images with inline workflow/text/table for multi-behavior diffusion vignette
src/plot.cpp Tightened dimension checks via explicit casts
src/Makevars Added standard OpenMP flags for non-Windows builds
src/Makevars.win Updated Windows build flags/libs to use standard OpenMP variables
src/Makevars.in Removed template Makevars used by the deleted autoconf flow
README.md Bumped referenced version and refreshed sessionInfo output
NEWS.md Updated release date and added “User-visible”/“Internal” headings + notes
man/figures/README-plot_diffnet2-withmap-1.png Updated rendered README figure artifact
man/epigames.Rd Minor whitespace/format cleanup
man/diffusion-data.Rd Table indentation/formatting adjustments
man/collapse_timeframes.Rd Minor whitespace/format cleanup
Makefile Removed --vanilla from Rscript invocations
configure.ac Removed autoconf configuration source
configure Removed generated configure script
cleanup Removed configure cleanup helper
.Rbuildignore Stopped ignoring src/Makevars so it is included in the package build
.github/workflows/r.yml Bumped core GitHub Actions versions (checkout/artifact upload)
.github/workflows/pkgdown.yml Bumped checkout + deploy-pages actions
.devcontainer/devcontainer.json Added an additional VS Code extension to the container
.devcontainer/Containerfile Switched to a smaller base image and added Quarto CLI installation

Comment on lines +37 to +46
**rdiffnet**( graph, seed.p.nodes, seed.nodes, behavior, threshold.dist)

**Step 0.0: setting *n* and *t* if not provided**
* this depends on graph

**Step 1.0: setting seed nodes**
* this depends on seed.p.nodes and seed.nodes

**Step 2.0: setting threshold for each node**
* ↳ `rdiffnet_make_threshold( threshold.dist, n )`
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vignette describes the old rdiffnet() workflow using seed.p.nodes, but the actual argument name in the package API is seed.p.adopt (see R/rdiffnet.r). This mismatch is likely to confuse readers and makes the “Step 1.0” description inconsistent with the rest of the vignette; consider updating the argument list and Step 1.0 text to use seed.p.adopt consistently.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,2 @@
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PKG_CXXFLAGS no longer defines -DARMA_64BIT_WORD and -DSTRICT_R_HEADERS (these were present in the previous Makevars(.in/.win)), and there’s no other place in the repo that sets them. If this package relies on 64-bit Armadillo indices and/or strict R headers, dropping these defines can change compilation behavior across platforms; consider restoring them (alongside the OpenMP flags) unless you’ve verified they are unnecessary.

Suggested change
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_64BIT_WORD -DSTRICT_R_HEADERS

Copilot uses AI. Check for mistakes.
# For testing
#PKG_CXXFLAGS=-Wall

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as src/Makevars: PKG_CXXFLAGS dropped -DARMA_64BIT_WORD and -DSTRICT_R_HEADERS and the repo doesn’t define them elsewhere. If these defines are still required for RcppArmadillo/R header compatibility on Windows toolchains, this can cause compilation warnings/errors or behavior changes; consider restoring them unless you’ve confirmed they’re safe to remove.

Suggested change
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_64BIT_WORD -DSTRICT_R_HEADERS

Copilot uses AI. Check for mistakes.
Comment on lines +221 to +231
int n = static_cast<int>(x.n_rows);
if (n != static_cast<int>(y.n_rows))
stop("-x- and -y- lengths do not coincide.");
if (n != static_cast<int>(toa.n_rows))
stop("-x- and -toa- lengths do not coincide.");
if (n != static_cast<int>(vertex_cex.n_rows))
stop("-x- and -vertex_cex- lengths do not coincide.");
if (graph.n_rows != graph.n_cols)
stop("-graph- is not a square matrix.");
if (static_cast<int>(graph.n_rows) != n)
stop("-graph- does not have the same number of rows as -x-, -y-, and -toa-.");
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These size checks cast Armadillo dimensions to int. On platforms where arma::uword is 64-bit, this can silently truncate very large objects and make the checks incorrect. Consider keeping the comparisons in arma::uword/std::size_t (and only casting at the R interface boundary if needed).

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +9
# Install quarto-cli and the orange-book extension
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.9.35/quarto-1.9.35-linux-${TARGETARCH}.deb && \
dpkg -i quarto-1.9.35-linux-${TARGETARCH}.deb && \
rm quarto-1.9.35-linux-${TARGETARCH}.deb
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The devcontainer downloads and installs the Quarto .deb directly via wget without any integrity verification (checksum/signature). Even though this is “dev-only”, it’s still a supply-chain risk; consider verifying a published SHA256 (or using a package manager / pinned digest) before installing.

Copilot uses AI. Check for mistakes.

docs:
Rscript --vanilla -e 'devtools::document()'
Rscript -e 'devtools::document()'
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing --vanilla from these Rscript invocations means user/site profiles and environment variables can influence devtools::install(), check(), and document(), which reduces reproducibility across machines. If the intent is reliable, “clean” local/CI builds, consider keeping --vanilla at least for check/docs targets.

Suggested change
Rscript -e 'devtools::document()'
Rscript --vanilla -e 'devtools::document()'

Copilot uses AI. Check for mistakes.
@gvegayon
Copy link
Copy Markdown
Member Author

gvegayon commented Apr 7, 2026

It should be good to go now. Merging

@gvegayon gvegayon merged commit ad6ed9d into master Apr 7, 2026
11 checks passed
@gvegayon gvegayon deleted the gvegayon/cran-1.25.0 branch April 7, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor issues for next CRAN release

3 participants